#! /bin/bash
import rospy
from std_msgs.msg import String
"""
初始化节点名称
创建话题对象
实例化消息类型

"""

rospy.init_node("pub")
pub=rospy.Publisher("che",String,queue_size=10)
msg=String()
rate=rospy.Rate(1)#一秒钟几次
i=0
while not rospy.is_shutdown():
    msg.data="hello "+(str)(i)
    pub.publish(msg)
    i+=1
    rospy.loginfo(msg.data)
    rate.sleep()